import numpy as np
from PIL import Image
a = np.array(Image.open('cat.jpg'))

#输出此图的高*宽*颜色，数据类型，某个点的颜色值
print(a.shape, a.dtype, a[100, 100])

#输出互补色并储存为cat2
b = 255 - a
Image.fromarray(b).save('cat2.jpg')

#输出黑色横条并存储为cat3
c = a.copy()
c[:, :, 2] = 0
Image.fromarray(c).save('cat3.jpg')

#输出白色横条并存储为cat4
d = a.copy()
d[:, :, 2] = 255
Image.fromarray(d).save('cat4.jpg')

#输出上下颠倒,左右也颠倒的图并存储为cat5
e = a.copy()
e = e[::-1]
Image.fromarray(e).save('cat5.jpg')

#输出只左右颠倒，不上下颠倒的图并储存为cat6
f = a.copy()
f = f[:, ::-1]
Image.fromarray(f).save('cat6.jpg')

#输出上下组合，下方照片上下颠倒、左右不颠倒的图片并储存为cat7
g = np.concatenate((a, e), axis=0)
Image.fromarray(g).save('cat7.jpg')

